package com.qunduikj.sjb.sdk.model.map;

import com.litesuits.orm.db.annotation.Column;
import com.litesuits.orm.db.annotation.PrimaryKey;
import com.litesuits.orm.db.annotation.Table;
import com.litesuits.orm.db.enums.AssignType;
import com.qunduikj.sjb.sdk.model.DataModel;
import com.qunduikj.sjb.sdk.utils.GlobalUtil;

@Table("gpsinfo")
public class GpsInfo extends DataModel {
    public static final String COL_USER_ID = "user_id";
    public static final String COL_ROUTE_ID = "route_id";
    public static final String COL_LONGITUDE = "longitude";
    public static final String COL_LATITUDE = "latitude";
    public static final String COL_ALTITUDE = "altitude";
    public static final String COL_TIME = "time";
    public static final String COL_ADDRESS = "address";
    public static final String COL_ACCURACY = "accuracy";
    public static final String COL_IS_UPDATE = "is_update";
    public static final int UPDATE_NO = 0;
    public static final int UPDATE_YES = 1;
    @PrimaryKey(AssignType.AUTO_INCREMENT)
    @Column("_id")
    public long _id;
    /**
     * 客户端仅需要下面字段,属性名暂不可改动(在数据库中有映射关系)
     */
    @Column(COL_USER_ID)
    public long userId;

    @Column(COL_ROUTE_ID)
    public long routeId;

    @Column(COL_LONGITUDE)
    public double longitude;

    @Column(COL_LATITUDE)
    public double latitude;

    @Column(COL_ALTITUDE)
    public double altitude;

    @Column(COL_TIME)
    public long time;

    @Column(COL_ADDRESS)
    public String address;

    @Column(COL_ACCURACY)
    public float accuracy;

    @Column(COL_IS_UPDATE)
    public int isUpdate;// 0未上传；1已上传

    public GpsInfo() {
    }

    public GpsInfo(double longitude, double latitude) {
        this.longitude = longitude;
        this.latitude = latitude;
    }

    public long getUserId() {
        return userId;
    }

    public GpsInfo setUserId(long userId) {
        this.userId = userId;
        return this;
    }

    public long getRouteId() {
        return routeId;
    }

    public GpsInfo setRouteId(long routeId) {
        this.routeId = routeId;
        return this;
    }

    public double getLatitude() {
        return latitude;
    }

    public GpsInfo setLatitude(double latitude) {
        this.latitude = latitude;
        return this;
    }

    public double getLongitude() {
        return longitude;
    }

    public GpsInfo setLongitude(double longitude) {
        this.longitude = longitude;
        return this;
    }

    public double getAltitude() {
        return altitude;
    }

    public GpsInfo setAltitude(double altitude) {
        this.altitude = altitude;
        return this;
    }

    public long getTime() {
        return time;
    }

    public GpsInfo setTime(long time) {
        this.time = time;
        return this;
    }

    public String getAddress() {
        return address;
    }

    public GpsInfo setAddress(String address) {
        this.address = address;
        return this;
    }

    public float getAccuracy() {
        return accuracy;
    }

    public GpsInfo setAccuracy(float accuracy) {
        this.accuracy = accuracy;
        return this;
    }

    public int getIsUpdate() {
        return isUpdate;
    }

    public GpsInfo setIsUpdate(int isUpdate) {
        this.isUpdate = isUpdate;
        return this;
    }

    @Override
    public String toString() {
        return "GpsInfo{" +
               "userId=" + userId +
               ", dateTime=" + GlobalUtil.formatTime(getTime(), "yyyy-MM-dd HH:mm:ss") +
               ", latitude=" + latitude +
               ", longitude=" + longitude +
               ", altitude=" + altitude +
               '}';
    }
}
